package com.banana.springcloud.controller;

import com.banana.springcloud.entity.CommonResult;
import com.banana.springcloud.entity.Payment;
import com.banana.springcloud.service.OpenFeignOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author layman
 * @date 2021/1/17
 */
@RestController
@Slf4j
@RequestMapping("/consumer/payment")
public class OpenFeignOrderController {

    @Resource
    private OpenFeignOrderService openFeignOrderService;

    @GetMapping("/get/{id}")
    public CommonResult<Payment> getPaymentById(@PathVariable("id") Long id){
        return openFeignOrderService.getPaymentById(id);
    }
    /**
     * openfeign-ribbon 客户端一般默认等待1秒钟
     */
    @GetMapping("/openfeign/timeout")
    public String TestOpenFeignTimeOut(){
        return openFeignOrderService.openFeignTimeOut();
    }
}
